package Model;

import java.util.Map;

import Bean.CarBean;
import Bean.LoginBean;
import Bean.RegistBean;
import Bean.ShopDataBean;
import Bean.XiangBean;
import Presenter.IPresenter;
import http.ApiService;
import http.RetrofitUtils;
import io.reactivex.Flowable;

/**
 * Created by ZhangTAO on 2017/12/21.
 */

public class IModel implements IMod{
    private IPresenter mpre;
    public IModel(IPresenter iPresenter) {
        this.mpre = iPresenter;
    }
    @Override
    public void getData(String url,Map<String, String> map) {
        Flowable<RegistBean> flowable1 = RetrofitUtils.getInstance(url).getRetrofit().create(ApiService.class).getRegist(map);
        mpre.setNewData1(flowable1);
    }

    @Override
    public void getData2(String url, Map<String, String> map) {
        Flowable<LoginBean> flowable2 = RetrofitUtils.getInstance(url).getRetrofit().create(ApiService.class).getLogin(map);
        mpre.setNewData2(flowable2);
    }

    @Override
    public void getData3(String url, Map<String, String> map) {
        Flowable<ShopDataBean> flowable3 = RetrofitUtils.getInstance(url).getRetrofit().create(ApiService.class).getShopdata(map);
        mpre.setNewData3(flowable3);
    }

    @Override
    public void getData4(String url, Map<String, String> map) {
        Flowable<XiangBean> flowable4 = RetrofitUtils.getInstance(url).getRetrofit().create(ApiService.class).getXiang(map);
        mpre.setNewData4(flowable4);
    }

    @Override
    public void getData5(String url, Map<String, String> map) {
        Flowable<CarBean> flowable5 = RetrofitUtils.getInstance(url).getRetrofit().create(ApiService.class).getCars(map);
        mpre.setNewData5(flowable5);
    }
}
